//
//  RootViewController.m
//  BGM
//
//  Created by 我要变好看 on 2018/12/10.
//  Copyright © 2018 com.alirtc.demo. All rights reserved.
//

#import "RootViewController.h"
#import "Common.h"
@interface RootViewController ()

@end

@implementation RootViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    UIScrollView *sc = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, SCREENW, SCREENH)];
    sc.pagingEnabled = YES;
    sc.contentSize = CGSizeMake(SCREENW * 4, SCREENH);
    [self.view addSubview:sc];
    NSArray *array1 = @[@"朋友互助",@"公益扩散",@"换个方式",@""];
    NSArray *array2 = @[@"建立有信任背书的帮忙行为",@"基于熟人脉络的爱心接力",@"打造全新的线上社会关系",@""];

    for (int i = 0; i<4; i++) {
        UIView *bgView = [[UIView alloc]initWithFrame:CGRectMake(i*SCREENW, 0, SCREENW, SCREENH)];
        bgView.backgroundColor = [UIColor whiteColor];
        [sc addSubview:bgView];
        UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, SCREENW/5*4, SCREENW/5*4+150)];
        [imageView setImage:[UIImage imageNamed:[NSString stringWithFormat:@"root%d",i+1]]];
        [bgView addSubview:imageView];
        if (i ==3) {
            
            UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, SCREENW/6, SCREENW/6)];
            [bgView addSubview:btn];
            [btn setImage:[UIImage imageNamed:@"root5"] forState:UIControlStateNormal];
            btn.center = CGPointMake(SCREENW/2, SCREENH-SCREENW/6-50);
            [btn addTarget:self action:@selector(gotoRoot) forControlEvents:UIControlEventTouchUpInside];

            
        }
        
        imageView.center = CGPointMake(SCREENW/2, SCREENH/2-50);

        UILabel *label1 = [[UILabel alloc]initWithFrame:CGRectMake(0, imageView.center.y+imageView.frame.size.height/2, SCREENW, 60)];
        label1.textColor = bgmmainColor;
        label1.text =[array1 objectAtIndex:i];
        label1.textAlignment = NSTextAlignmentCenter;
        label1.font = [UIFont boldSystemFontOfSize:25];
        [bgView addSubview:label1];
        
        UILabel *label2 = [[UILabel alloc]initWithFrame:CGRectMake(0, imageView.center.y+imageView.frame.size.height/2+60, SCREENW, 40)];
        label2.textColor = bgmmainColor;
        label2.text = [array2 objectAtIndex:i];
        label2.textAlignment = NSTextAlignmentCenter;
        label2.font = [UIFont systemFontOfSize:20];
        [bgView addSubview:label2];
        
    }
    
//    UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(15+SCREENW, SCREENH-40, SCREENW-30, 40)];
//    btn.backgroundColor = bgmyelloeColor ;
//    [btn setTitle:@"进入应用" forState:UIControlStateNormal];
//    btn.layer.cornerRadius = 5;
//    btn.layer.masksToBounds = YES;
//    [btn addTarget:self action:@selector(gotoRoot) forControlEvents:UIControlEventTouchUpInside];
//    [sc addSubview:btn];
}
- (void)gotoRoot{
    if(self.RootActionClickBlock){
        self.RootActionClickBlock();
        
    }
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
